package com.gxc.service.user.controller;

import com.gxc.service.common.model.ServerResponse;
import com.gxc.service.user.entity.UserEntity;
import com.gxc.service.user.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * UserController.
 *
 * @author GongXincheng
 * @since 2019-10-10 13:37
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/{id}")
    public ServerResponse<UserEntity> getUserById(@PathVariable("id") Long id) {
        UserEntity entity = userService.getUserById(id);
        return ServerResponse.ok(entity);
    }

}
